# 登录-管理员
import requests

login_url = "http://ihrm-test.itheima.net/api/sys/login"
login_headers = {"Content-Type": "application/json"}
login_body = {"mobile": "13800000002", "password": "123456"}
resp = requests.post(login_url, headers=login_headers, json=login_body)
print(resp.json())
token = "Bearer " + resp.json()["data"]

# # 员工新增
# add_user_url = "http://ihrm-test.itheima.net/api/sys/user"
# add_user_headers = {"Content-Type": "application/json", "Authorization": token}
# add_user_body = {
#     "username": "YG",
#     "mobile": "18210222002",
#     "workNumber": "123"
# }
#
# resp = requests.post(url=add_user_url, headers=add_user_headers, json=add_user_body)
# print(resp.json())
#
# # 员工查询
# query_user_url = "http://ihrm-test.itheima.net/api/sys/user/1518776005844647936"
# query_user_headers = {"Content-Type": "application/json", "Authorization": token}
# resp = requests.get(url=query_user_url, headers=query_user_headers)
# print(resp.json())
#
# # 员工修改
# modify_user_url = "http://ihrm-test.itheima.net/api/sys/user/1518776005844647936"
# modify_body = {
#     "username": "YG002",
#     "password": "123456",
#     "departmentId": "10086"
# }
# resp = requests.put(modify_user_url, headers=add_user_headers, json=modify_body)
# print(resp.json())
# # 员工删除
# delete_user_url = "http://ihrm-test.itheima.net/api/sys/user/1518776005844647936"
# resp = requests.delete(delete_user_url, headers=add_user_headers)
# print(resp.json())